package com.yunsc.store.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yunsc.common.annotation.JsonDesensitize;
import com.yunsc.common.desensitize.DesensitizeType;
import com.yunsc.common.serializer.TimestampToDateSerializer;
import lombok.Data;

import java.io.Serializable;

/**
 * 用户记录表
 *
 * @author adan
 * @email 2028038953@qq.com
 * @date 2024-04-05 01:37:42
 */
@Data
@TableName("yunsc_user")
public class YunscUserEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @TableId
    private Integer userId;
    /**
     * 用户手机号
     */
    @JsonDesensitize(type = DesensitizeType.TEL)
    private String mobile;
    /**
     * 用户昵称
     */
    // @JsonDesensitize(type = DesensitizeType.EMAIL)
    @JsonDesensitize(type = DesensitizeType.TEL)
    private String nickName;
    /**
     * 头像文件ID
     */
    private Integer avatarId;
    /**
     * 性别
     */
    private Integer gender;
    /**
     * 国家
     */
    // @JsonDesensitize(type = DesensitizeType.ID_CARD)
    private String country;
    /**
     * 省份
     */
    // @JsonDesensitize(type = DesensitizeType.PASSWORD)
    private String province;
    /**
     * 城市
     */
    // @JsonDesensitize(type = DesensitizeType.CUSTOM, regex = ".(.)", group = 1, length = 1)
    private String city;
    /**
     * 默认收货地址
     */
    private Integer addressId;
    /**
     * 用户可用余额
     */
    private String balance;
    /**
     * 用户可用积分
     */
    private Integer points;
    /**
     * 用户总支付的金额
     */
    private String payMoney;
    /**
     * 实际消费的金额(不含退款)
     */
    private String expendMoney;
    /**
     * 会员等级ID
     */
    private Integer gradeId;
    /**
     * 注册来源的平台 (APP、H5、小程序等)
     */
    private String platform;
    /**
     * 最后登录时间
     */
    @JsonSerialize(using = TimestampToDateSerializer.class)
    private Integer lastLoginTime;
    /**
     * 是否删除
     */
    private Integer isDelete;
    /**
     * 商城ID
     */
    private Integer storeId;
    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonSerialize(using = TimestampToDateSerializer.class)
    private Integer createTime;
    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonSerialize(using = TimestampToDateSerializer.class)
    private Integer updateTime;

    @TableField(exist = false)
    private String avatarUrl;

    @TableField(exist = false)
    private YunscUserGradeEntity grade;

    // @TableField(exist = false)
    // @JsonInclude(JsonInclude.Include.NON_NULL)
    // private YunscUserAddressEntity address;
}
